<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:include="head :: head">
    <link rel="import" href="../head.html"/>
</head>
<body class="nav-md">
<link rel="stylesheet" href="../../static/css/module_css/style.css"
      th:href="@{/css/module_css/style.css}"/>

<style>
    .span_text {
        display: block;
        position: absolute;
        left: -20px;
        top: 18px;
        width: 16px;
        height: 16px;
        text-align: center;
        line-height: 16px;
        font-size: 12px;
        color: #fa5959;
        border: 1px solid #fa5b5b;
        border-radius: 16px;

    }

    .span_text.en {
        top: 7px;
        height: 35px;
        border: 1px solid #9935fe;
    }

    .span_text.en em {
        color: #9935fe;
        font-style: normal;
        font-weight: normal;
    }

    .span_text.on {
        border: 1px solid #9935fe;
        color: #9935fe;
    }
</style>
<div class="container body">
    <div class="main_container">
        <div id="teamworking_letree" class="col-md-3 left_col" th:replace="letree :: letree">
        </div>
        <!-- top navigation  -->
        <div class="top_nav" th:include="header :: top">

        </div>
        <div class="right_col" role="main">
        </div>
    </div>
</div>

<footer th:include="head :: footer"></footer>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/

    /*]]>*/
</script>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    $(function () {//默认加载数据的table--(work_list)
        //将登陆人姓名存入sessionStorage中
        sessionStorage.setItem("userName", [[${empName}]]);
        document.cookie = "userName=[[${empName}]];"
        var eventId = [[${eventId}]];
        if (eventId != null) {
//            $("#event tr").each(function () {
//                if ($(this).attr("id") == eventId) {
//                    $(this).click;
//                }
//            })
            $.goTo("toGWorkList?eventId=" + eventId);
        } else {
            $.goTo(/*[[@{/eventTurn/toGWorkList}]]*/"./work_list2.html");
        }
    });

    //展示时间轴附件信息
    function getEventAccessory(id) {
        var img = "";
        var mp4 = "";
        var mp3 = "";

        $.post("/event/getEventAccessory", {"eventId": id}, function (result) {
            $("#mp3").empty();
            $("#mp4").empty();
            $("#eventImg").empty();
            $.each(result, function (index, item) {
                if (item.accessoryType == "1") {
                    img += "<div class='item '>" +
                        "<img src='" + item.accessoryPath + "' alt='...'>" +
                        "<div class='carousel-caption'>" +
                        "</div>" +
                        "</div>"
                }

                if (item.accessoryType == "3") {
                    //视频
                    mp4 += "<video width='320' height='240' controls>" +
                        " <source  src='" + item.accessoryPath + "' width='352' height='264' controls autobuffer type='video/mp4'>" +
                        "       您的浏览器不支持 HTML5 video 标签。" +
                        "</video>"
                }

                if (item.accessoryType == "2") {
                    //音频
                    mp3 += "<audio controls>" +
                        "<source  height='100' width='352' src='" + item.accessoryPath + "' type='audio/ogg'>" +
                        " 您的浏览器不支持 audio 元素。" +
                        "</audio>"
                }
            });

            $("#mp3").append(mp3);
            $("#mp4").append(mp4);
            $("#eventImg").append(img);
            $("#eventImg").find(".item").eq(0).addClass("active");
            $("#ModalInfo").modal('show');
        });
    }

    $.extend({
        goToEmpTree: function (url, data) {
            $("#4tab_content5").load(url, data, function (res) {
                return true;
            });
        }
    })

    //分页跳转
    function up(number) {//分页跳转，上一页
        /*[+
         var findForm = $("#findForm").serialize();
         var number = parseInt(number);
         $.goTo("/eventTurn/toGWorkList?page="+number,findForm);
         +]*/
    }
    function next(number) {//分页跳转，下一页
        /*[+
         var number = parseInt(number) + 2;
         $.goTo("/eventTurn/toGWorkList?page="+number);
         +]*/
    }
    function pageTo(page) {
        /*[+
         var number = page;
         $.goTo("/eventTurn/toGWorkList?page=" + number);
         +]*/

    }
    /*]]>*/
</script>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/

    //打开根据按钮打开model
    function model(obj) {
        var val = $(obj).attr("id");
        var taskId = $(obj).attr("value");
        var eventId = $(obj).attr("eventId");
        //非派遣执法步骤   执法中队 打开正常下一步model
        if (val == "上报街道") {
            //下派分队model
            $("#myModa2").modal('show')
            $("#outcome3").val(val);
            $("#taskId3").val(taskId)
            $("#complete3").text(val);
        } else if (val == "交办执办" || val == "派遣执办") {
            //下派执法人员
            $("#myModa3").modal('show')
            $("#outcome4").val(val);
            $("#taskId4").val(taskId)
            $("#complete4").text(val);
//            $.goToEmpTree("/toEmpTree?eventId="+eventId)
        } else if (val == "派发部门") {
            $("#myModa4").modal('show')
            $("#outcome5").val(val);
            $("#taskId5").val(taskId)
            $("#complete5").text(val);
        } else {
            //普通下一步
            // $("#myModa3").modal('show')
            $("#myModal").modal('show')
            $("#complete").text(val);
            $("#outcome").val(val);
            $("#taskId2").val(taskId)
        }

    }

    //正常下一步model
    function complete2() {
        if ($("#comment1").val() != "" && $("#comment1").val() != null) {
            $.MsgBox.Confirm("提示", "确认上传吗？", function () {
                $.ajax({
                    url: '/event/completeTask',
                    type: 'POST',
                    async: false,
                    cache: false,
                    data: new FormData($('#findForm')[0]),
                    processData: false,
                    contentType: false,
                    success: function (res) {
                        $.MsgBox.Alert("提示", "上传成功");
                        $("#myModal").modal('hide');
                        $(".modal-backdrop").css("display", "none");
                        $.goTo("/eventTurn/toGWorkList");
                    }
                })
            });
        } else {
            $.MsgBox.Alert("提示", "请填写处理意见！");
        }
    }

    //上报街道
    function completeFendui() {
        var assignessList = $("#treeOrgId").val();
        if (assignessList == "") {
            $.MsgBox.Alert("提示", "请选择执法部门！");
        } else if ($("#comment2").val() != "" && $("#comment2").val() != null) {
            $("#assigneeList2").val(assignessList)
            $.ajax({
                url: '/event/completeTask',
                type: 'POST',
                async: false,
                cache: false,
                data: new FormData($('#findForm2')[0]),
                processData: false,
                contentType: false
            }).done(function (res) {
                $.MsgBox.Alert("提示", "上传成功");
                $("#myModal").modal('hide');
                $(".modal-backdrop").css("display", "none");
                $.goTo("/eventTurn/toGWorkList");
            }).fail(function (res) {
                $.MsgBox.Alert("提示", "上传失败");
            });
            $("#myModa2").modal('hide')
            $.goTo(/*[[@{/eventTurn/toGWorkList}]]*/"./work_list2.html");
        } else {
            $.MsgBox.Alert("提示", "请填写处理意见！！");
        }
    }

    //下派到人
    function completeEmps() {
        var assignessList = $("#treeEmpId").val();
        if (assignessList == "") {
            $.MsgBox.Alert("提示", "请选择下派人员！");
        } else if ($("#comment3").val() != "" && $("#comment3").val() != null) {
            $("#assigneeList3").val(assignessList);
            $.ajax({
                url: '/event/completeTask',
                type: 'POST',
                async: false,
                cache: false,
                data: new FormData($('#findForm3')[0]),
                processData: false,
                contentType: false
            }).done(function (res) {
                $.MsgBox.Alert("提示", "上传成功");
                $("#myModa3").modal('hide');
                $(".modal-backdrop").css("display", "none");
                $.goTo("/eventTurn/toGWorkList");
            }).fail(function (res) {
                $.MsgBox.Alert("提示", "上传失败");
            });
            $("#myModa3").modal('hide')
            $.goTo(/*[[@{/eventTurn/toGWorkList}]]*/"./work_list2.html");
        } else {
            $.MsgBox.Alert("提示", "请填写处理意见！！");
        }
    }

    //交办社区
    function completeComm() {
        var assignessList = $("#treeComId").val();
        if (assignessList == "") {
            $.MsgBox.Alert("提示", "请选择执法部门！");
        } else if ($("#comment4").val() != "" && $("#comment4").val() != null) {
            $("#assigneeList4").val(assignessList);
            $.ajax({
                url: '/event/completeTask',
                type: 'POST',
                async: false,
                cache: false,
                data: new FormData($('#findForm4')[0]),
                processData: false,
                contentType: false
            }).done(function (res) {
                $.MsgBox.Alert("提示", "上传成功");
                $("#myModa3").modal('hide');
                $(".modal-backdrop").css("display", "none");
                $.goTo("/eventTurn/toGWorkList");
            }).fail(function (res) {
                $.MsgBox.Alert("提示", "上传失败");
            });
            $("#myModa3").modal('hide')
            $.goTo(/*[[@{/eventTurn/toGWorkList}]]*/"./work_list2.html");
        } else {
            $.MsgBox.Alert("提示", "请填写处理意见！！");
        }
    }

    /*]]>*/
</script>
</body>
</html>